package homework;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo2 {
    public static void main(String[] args) {
        TreeSet<Double>list = new TreeSet<>(new Comparator<Double>() {
            @Override
            public int compare(Double o1, Double o2) {
                double v = o2.getNumber() - o1.getNumber();
              return  (int)  v == 0 ? 1 : (int) v;
            }
        });

        Double d1 = new Double(1.1);
        Double d2 = new Double(5.2);
        Double d3 = new Double(6.3);
        Double d4 = new Double(2.5);
        Double d5 = new Double(5.2);
        Double d6 = new Double(3.3);
        list.add(d1);
        list.add(d2);
        list.add(d3);
        list.add(d4);
        list.add(d5);
        list.add(d6);
        System.out.println(list);

    }
}
